package com.accenture.adf.newcodington.module12.sample;
import java.util.*;

/**
 * 
 * Topic: Demo on using the List data type from the Java collection framework
 * 
 * Instructions:
 * 1. Create a 'ListDemo' class
 * 2. Create a main() method that will perform the following functions
 *    a. Create a list using the ArrayList constructor
 *    b. Populate the list with two elements, "Zoo" and "Park"
 *    c. Use the list.size() method to retrieve the number of elements in the list
 *       and print the results
 *    d. Print all the elements of the list
 *    
 */

public class ListDemo {
	
	
	public static void main(String[] args) {

		// Create the list object using ArrayList
	    List list = new ArrayList();          // List implemented as growable array
	    
	    // Appending elements into the list
	    list.add("Zoo");
	    list.add("Park");
	    
	    // Get the number of elements in the list
	    int size = list.size();          // 2
	    System.out.println("Size of collection is: "+size);
	    
	    // Retrieving the elements from the list
	    for(int i=0;i<list.size();i++)
	    {
	    	System.out.println("Element["+i+"] is: "+list.get(i));
	    }
	}

}